//
//  HttpTool.h
//  easymarketing
//
//  Created by HailongHan on 14/12/22.
//  Copyright (c) 2014年 cubead. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface HttpTool : NSObject

/**
 *  Get请求类封装
 *
 *  @param url     url
 *  @param params  参数
 *  @param success 成功返回
 *  @param failure 失败返回
 */
+ (void)get:(NSString *)url params:(NSDictionary *)params success:(void (^)(id responseObj))success failure:(void (^)(NSError *error))failure;

/**
 *  Post请求类封装
 *
 *  @param url     url
 *  @param params  参数
 *  @param success 成功
 *  @param failure 失败
 */
+ (void)post:(NSString *)url params:(NSDictionary *)params success:(void (^)(id responseObj))success failure:(void (^)(NSError *error))failure;

/**
 *  Put请求类封装
 *
 *  @param url     url
 *  @param params  参数
 *  @param success 成功
 *  @param failure 失败
 */
+ (void)put:(NSString *)url params:(NSDictionary *)params success:(void (^)(id))success failure:(void (^)(NSError *))failure;

+ (void)postUploadImage:(NSString*)urlStr andMimeType:(NSArray*)mimeType andData:(NSArray *)data success:(void (^)(id))success failure:(void (^)(NSError *))failure;

/**
 *  Delete请求类封装
 *
 *  @param url     url
 *  @param params  参数
 *  @param success 成功
 *  @param failure 失败
 */
+(void)delete:(NSString *)url params:(NSDictionary *)params success:(void (^)(id))success failure:(void (^)(NSError *))failure;

+ (void)download:(NSString *)url progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler;

@end
